package com.edu.service.impl;

import com.edu.service.BookService;

/**
 * @Author:mx
 * @Date:2025/11/10-15:53:06
 */
public class BookServiceProxy implements BookService {

    private BookService bs;

    public BookServiceProxy(BookService bs) {
        this.bs = bs;
    }

    @Override
    public void addBook() {
        long start   = System.currentTimeMillis();
        bs.addBook();
        long end = System.currentTimeMillis();
        System.out.println("addBook执行耗时:"+(end-start));
    }

    @Override
    public void deleteBook() {
        long start   = System.currentTimeMillis();
        bs.deleteBook();
        long end = System.currentTimeMillis();
        System.out.println("delete执行耗时:"+(end-start));
    }

    @Override
    public void updateBook() {
        long start   = System.currentTimeMillis();
        bs.updateBook();
        long end = System.currentTimeMillis();
        System.out.println("updateBook执行耗时:"+(end-start));
    }

    @Override
    public void selectBook() {
        long start  = System.currentTimeMillis();
        bs.selectBook();
        long end = System.currentTimeMillis();
        System.out.println("selectBook执行耗时:"+(end-start));
    }

    @Override
    public int selectBookById(int bookId) {
        long start  = System.currentTimeMillis();
        bs.selectBookById(bookId);
        long end = System.currentTimeMillis();
        System.out.println("selectBook执行耗时:"+(end-start));
        return 1;
    }
}
